﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Man adam = new Man(null, null, "Адам");
            Console.WriteLine(adam.Hello());
            Woman eva = new Woman(null, null, "Ева");
            Console.WriteLine(eva.Hello());
            Man vovan = new Man(adam, eva, "Вован");
            Console.WriteLine(vovan.Hello());
            Woman kain = new Woman(adam, eva, "Каин");
            Console.WriteLine(kain.Hello());
            Man enot = new Man(vovan, kain, "Енот");
            Console.WriteLine(enot.Hello());
            Man man = new Man(enot, kain, "");
            man.GetRandomName();
            Console.WriteLine(man.Hello());
            Console.ReadLine();
        }
    }
    class Human
    {
        Man Father;
        Woman Mother;
        public string Firstname;
        List<Human> children = new List<Human>();
        public static string[] names = new string[10];
        public Human(Man father , Woman mother, string name)
        {
            Father = father;
            Mother = mother;
            Firstname = name;
            names[0] = "Виталий";
            names[1] = "Никита";
            names[2] = "Олег";
            names[3] = "Илья";
            names[4] = "Андрей";
            names[5] = "Влада";
            names[6] = "Маша";
            names[7] = "Аня";
            names[8] = "Даша";
            names[9] = "Вика";
        }
        public virtual string Hello()
        {
            string result;
            result = String.Format("Привет! Меня зовут {0}. ", Firstname );
            if (Father == null)
            {
                result += " У меня нет отца.";
            }
            else
            {
                result += " Мой отец - " + Father.Firstname + ".";
            }

            if (Mother == null)
            {
                result += " У меня нет матери.";
            }
            else
            {
                result +=" Моя мать - " + Mother.Firstname + ".";
            }
            return result;
        }

    }

    class Man : Human
    {
        public void GetRandomName()
        {
            Random rd = new Random();
            Firstname = names[Convert.ToInt32(rd.Next(0, 4))];
        }
        public Man(Man father, Woman mother, string name) : base(father, mother, name)
        {
          
        }
        public override string Hello()
        {
            return base.Hello() + " Я мужского пола.";
        }
    }

    class Woman : Human
    {
        public void GetRandomName()
        {
            Random a = new Random();
            Firstname = names[Convert.ToInt16(a.Next(5, 9))];
        }
        public Woman(Man father, Woman mother, string name) : base(father, mother, name)
        {

        }
        public override string Hello()
        {
            return base.Hello() + " Я женского пола.";
        }
    }
 }
